﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace RushTracker.Core.Internationalization
{
    public class Language
    {
        private Dictionary<string, string> _dict = new Dictionary<string, string>();

        public Language(string languageFile)
        {
            StreamReader reader = new StreamReader(languageFile);
            string content = reader.ReadToEnd();
            reader.Close();

            foreach (string line in content.Split(new char[] { '\r', '\n' }))
            {
                if (!String.IsNullOrEmpty(line))
                {
                    string[] pair = line.Split('=');

                    if (pair.Length == 2)
                    {
                        this._dict.Add(pair[0].Trim(), pair[1].Trim());
                    }
                }
            }
        }

        public string this[string key]
        {
            get { return this._dict[key]; }
        }
    }
}
